<?php

namespace App\Models\CarModels;

use App\Models\SystemManagement\Employee;
use Illuminate\Database\Eloquent\Model;

class EquipmentTaskRecord extends Model
{
    /**
     *
     */

    protected $table = 'equipment_task_records';
    protected $fillable = ['summary','task_time','detail','staff_id','tools','task_kind_detail_id','task_time',
        'finish_time','status_id','is_tmp'
        ];


    public function staff()
    {
        return $this->belongsTo(Employee::class,'staff_id','id');
    }

    public function task_kind_detail()
    {
        $data =  $this->belongsTo(EquipmentTaskDetailKind::class,'task_kind_detail_id','id')->with('kind');
        return $data;
    }

//    public function test1()
//    {
//        return $this->hasOneThrough(EquipmentTaskDetailKind::class,EquipmentTaskKind::class,'task_kind_id');
//    }

    protected $searchable = [
        /**
         * Columns and their priority in search results.
         * Columns with higher values are more important.
         * Columns with equal values have equal importance.
         *
         * @var array
         */
        'columns' => [
            'equipment_task_records.summary' => 10,
        ]

    ];


}
